import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
@Injectable({
  providedIn: 'root'
})
export class ShareMsgService {
  constructor() { }
  private msg = new Subject<any>();
  //发送消息
  sendMessage(message: any) {
    this.msg.next(message);
  }
  //清除消息
  clearMessage() {
    this.msg.next();
  }
  //获取消息
  getMessage(): Observable<any> {
    return this.msg.asObservable();
  }

}

